home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload Trio 2 / Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO / dir24 / psi110g.zip / SMTP.H < prev    next >
C/C++ Source or Header  |  1994-08-26  |  3KB  |  98 lines

  1. #ifndef _SMTP_H
  2. #define _SMTP_H
  3.   
  4. #define SMTPTRACE           /* enable tracing for smtp */
  5. #define MAXSESSIONS 10      /* most connections allowed */
  6. #define JOBNAME     13      /* max size of a job name with null */
  7. #define LINELEN     256
  8. #define PLINELEN    256
  9. #define RLINELEN    512
  10. #define TLINELEN    1024
  11. #define SLINELEN    64
  12. #define MBOXLEN     8       /* max size of a mail box name */
  13.   
  14. /* types of address used by smtp in an address list */
  15. #define BADADDR     0
  16. #define LOCAL       1
  17. #define DOMAIN      2
  18. #define NNTP_GATE   3
  19.   
  20. /* a list entry */
  21. struct list {
  22.     struct list *next;
  23.     char *val;
  24.     char type;
  25. };
  26.   
  27. /* Per-session control block  used by smtp server */
  28. struct smtpsv {
  29.     int s;          /* the socket for this connection */
  30.     char *system;       /* Name of remote system */
  31.     char *from;     /* sender address */
  32.     struct list *to;    /* Linked list of recipients */
  33.     char *bid;      /* BID if any */
  34.     int dupbid;     /* indicates a duplicate bid */
  35.     FILE *data;     /* Temporary input file pointer */
  36. };
  37.   
  38. /* used by smtpcli as a queue entry for a single message */
  39. struct smtp_job {
  40.     struct  smtp_job *next; /* pointer to next mail job for this system */
  41.     char    jobname[9]; /* the prefix of the job file name */
  42.     long    len;        /* length of file */
  43.     char    *from;      /* address of sender */
  44.     struct list *to;    /* Linked list of recipients */
  45. };
  46.   
  47. /* control structure used by an smtp client session */
  48. struct smtpcli {
  49.     int     s;      /* connection socket */
  50.     int32   ipdest;     /* address of forwarding system */
  51.     char    *destname;  /* domain address of forwarding system */
  52.     char    *wname;     /* name of workfile */
  53.     char    *tname;     /* name of data file */
  54.     char    buf[LINELEN];   /* Output buffer */
  55.     char    cnt;        /* Length of input buffer */
  56.     FILE    *tfile;
  57.     struct  smtp_job *jobq;
  58.     struct  list    *errlog;
  59.     int lock;       /* In use */
  60. };
  61.   
  62. /* smtp server routing mode */
  63. #define QUEUE   1
  64.   
  65. #define NULLLIST    (struct list *)0
  66. #define NULLSMTPSV  (struct smtpsv *)0
  67. #define NULLSMTPCLI (struct smtpcli *)0
  68. #define NULLJOB     (struct smtp_job *)0
  69.   
  70. extern int Smtpmode;
  71. extern char *Mailspool;
  72. extern char *Maillog;
  73. extern char *Mailqdir;      /* Outgoing spool directory */
  74. extern char *Routeqdir; /* spool directory for a router program */
  75. extern char *Mailqueue; /* Prototype of work file */
  76. extern char *Maillock;      /* Mail system lock */
  77. extern char *Alias;     /* File of local aliases */
  78.   
  79. /* In smtpserv.c: */
  80. char *ptime __ARGS((long *t));
  81. long get_msgid __ARGS((void));
  82. char *getname __ARGS((char *cp));
  83. int validate_address __ARGS((char *s));
  84. int queuejob __ARGS((FILE *dfile,char *host,struct list *to,char *from));
  85. struct list *addlist __ARGS((struct list **head,char *val,int type));
  86. int mdaemon __ARGS((FILE *data,char *to,struct list *lp,int bounce));
  87.   
  88. /* In smtpcli.c: */
  89. void smtptick __ARGS((void *t));
  90. int mlock __ARGS((char *dir,char *id));
  91. int rmlock __ARGS((char *dir,char *id));
  92. void del_list __ARGS((struct list *lp));
  93. int32 mailroute __ARGS((char *dest));
  94. extern char *Months[];
  95.   
  96. #endif  /* _SMTP_H */
  97.   
  98.